<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计数器-Vue.js</title>
    <script src="../lib/vue-2.6.12.js"></script>
</head>
<body>
<div id="app">
    <button @click="subtract">-</button>
    <h1>进球数：{{num}}</h1>
    <button @click="add">+</button>
</div>
<script>
    var vm = new Vue({
        el:'#app',
        data:{
            num: 0,
        },
        methods:{
            subtract: function(){
                this.num--;
                console.log('1hello vue')
            },
            add: function(){
                this.num++;
                console.log('2hello vue')
            }
        }
    })

</script>
</body>
</html>